<%@page import="Entities.*"%>
<%@page import="Helpers.*"%>
<%@page import="Hibernate.*"%>
<%@page import="java.util.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<div class="box4">

    <div class="top"></div>
    <div class="spacer">

      <%
        //als form nog niet ingevuld is dan show form
        String userrol = (String) session.getAttribute("rol");
        String pid = (String) session.getAttribute("pid");
        String error = (String) request.getParameter("error");
        boolean error2 = Boolean.parseBoolean(error);
        if(error2 == true)
        {
      %>
         <p class="Logintext">Combinatie email en wachtwoord onjuist. &nbsp;&nbsp;
                              <a href="webpages/Personen/registreer.jsp">Registreer</a>
         </p>
         <br>
      <%
        }
        if(userrol == null)
        {
          userrol = "0";
          if (error2 == false)
            {
      %>
              <p class="Logintext"><a href="webpages/Personen/registreer.jsp">Registreer</a> of login:</p><br/>
         <% } %>
       <form id="formid" name="form" method="post" action="login.jsp">
            <input type="hidden" name="pad" value="<%=request.getRequestURL().toString()%>"/>
            <input type="login" name="login" id="email" />
            <input  type="password" name="wachtwoord" id="password" value="" onBlur="showTextField()" onPaste="showPasswordField()" onChange="showPasswordField()" onKeyPress="return enterHandler(event, 'inloggenForm')" />
            <input  type="text" name="wachtwoord" id="passwordDummy" onFocus="return showPasswordField()" value="- Wachtwoord -" />
            <input type="submit" name="submit" id="inloggen" value="Inloggen" />
            <br />
            <input name="onthouden" type="checkbox" id="onthouden" value="Gegevens onthouden" checked="checked" /><label for="onthouden">Gegevens onthouden</label>
        </form>
        
        <%}else{
          PersonenHelper pHelper = new PersonenHelper();
          Personen persoon = pHelper.getPersoon(Integer.parseInt(pid));
        %>
           <img src="content/img/nopicture.jpg" align="left" class="imgleft"/>
          <span>Hallo, <%=persoon.getVoornaam()%>  <%=persoon.getAchternaam() %></span>
          <br>
Je bent ingelogd als <strong><%=persoon.getRollen().getNaam()%></strong>! <a href="webpages/Personen/showPersoon.jsp?id=<%= pid %>">Profiel wijzigen</a> of <a href="logout.jsp">Uitloggen</a>
        <%}%>
    </div>
    <!--/spacer -->
    <div class="bot"></div>
</div>



<!--/box4 -->